<%@ page language="java" contentType="text/html; charset=US-ASCII"
    pageEncoding="US-ASCII"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Insert title here</title>
</head>
<body>
<FORM NAME="form2">
	Input A:<INPUT type="text" name="inputA" size="5">
	Input B:<INPUT type="text" name="inputB" size="5">
	Input C:<INPUT type="text" name="inputC" size="5">
<br /><b>Answer:</b><%= session.getAttribute("result") %><INPUT type="text" name="answer" size="35">
</FORM>
<%
	if (request.getParameterNames() != null)
	{
		%> You Clicked
		<%= request.getParameter("buttonName") %>
		<%
	}
%>


<FORM NAME="form1" action="/Calculator/Calculator" METHOD="POST">
	<INPUT TYPE="HIDDEN" NAME="buttonName">
	<INPUT TYPE="BUTTON" NAME="oper" VALUE="7" ONCLICK="button7()">
	<INPUT TYPE="BUTTON" NAME="oper" VALUE="8" ONCLICK="button8()">
	<INPUT TYPE="BUTTON" NAME="oper" VALUE="9" ONCLICK="button9()">
	<INPUT TYPE="BUTTON" NAME="oper" VALUE="Sin()" ONCLICK="buttonSin()">
	<INPUT TYPE="BUTTON" NAME="oper" VALUE="Cos()" ONCLICK="buttonCos()">
	<INPUT TYPE="BUTTON" NAME="oper" VALUE="Derivative" ONCLICK="buttonDerivative()" STYLE="width:100px">
	
	<br /><INPUT TYPE="BUTTON" NAME="oper" VALUE="4" ONCLICK="button4()">
	<INPUT TYPE="BUTTON" NAME="oper" VALUE="5" ONCLICK="button5()">
	<INPUT TYPE="BUTTON" NAME="oper" VALUE="6" ONCLICK="button6()">
	<INPUT TYPE="BUTTON" NAME="oper" VALUE="padd" STYLE="width:50px">
	<INPUT TYPE="BUTTON" NAME="oper" VALUE="Tan()" ONCLICK="buttonTan()">
	<INPUT TYPE="BUTTON" NAME="oper" VALUE="Integral" ONCLICK="buttonIntegral()" STYLE="width:100px">
	
	<br /><INPUT TYPE="BUTTON" NAME="oper" VALUE="1" ONCLICK="button1()">
	<INPUT TYPE="BUTTON" VNAME="oper" ALUE="2" ONCLICK="button2()">
	<INPUT TYPE="BUTTON" NAME="oper" VALUE="3" ONCLICK="button3()">
	<INPUT TYPE="BUTTON" NAME="oper" VALUE="padd" STYLE="width:50px">
	<INPUT TYPE="BUTTON" NAME="oper" VALUE="*" STYLE="height:25px; width:50px" ONCLICK="buttonMultiplication()">
	<INPUT TYPE="BUTTON" NAME="oper" VALUE=&radic; STYLE="width:100px" ONCLICK="buttonSquareRoot()">
	
	<br /><INPUT TYPE="button" NAME="oper" VALUE="+" ONCLICK="buttonPlus()">
	<INPUT TYPE="BUTTON" NAME="oper" VALUE="0" ONCLICK="button0()">
	<INPUT TYPE="BUTTON" NAME="oper" VALUE="-" ONCLICK="buttonMinus()">
	<INPUT TYPE="SUBMIT" NAME="oper" VALUE="Enter">
	<INPUT TYPE="BUTTON" NAME="oper" VALUE="/" STYLE="height:25px; width:50px" ONCLICK="buttonDivision()">
	<INPUT TYPE="BUTTON" NAME="oper" VALUE="Quadratic" STYLE="width:100px" ONCLICK="buttonQuadratic()">

	
</FORM>

<SCRIPT LANGUAGE="JavaScript">
	<!--
	function button0()
	{
		document.form1.buttonName.value = "0";
		//if (document.form2.inputA.focused() == true)
			document.form2.inputA.value = "0";

	}
	function button1()
	{
		document.form1.buttonName.value = "1";
		form1.submit();
	}
	function button2()
	{
		document.form1.buttonName.value = "2";
		form1.submit();
	}
	function button3()
	{
		document.form1.buttonName.value = "3";
		form1.submit();
	}
	function button4()
	{
		document.form1.buttonName.value = "4";
		form1.submit();
	}
	function button5()
	{
		document.form1.buttonName.value = "5";
		form1.submit();
	}
	function button6()
	{
		document.form1.buttonName.value = "6";
		form1.submit();
	}
	function button7()
	{
		document.form1.buttonName.value = "7";
		form1.submit();
	}
	function button8()
	{
		document.form1.buttonName.value = "8";
		form1.submit();
	}
	function button9()
	{
		document.form1.buttonName.value = "9";
		form1.submit();
	}
	function buttonSin()
	{
		document.form1.buttonName.value = "Sin()";
		form1.submit();
	}
	function buttonCos()
	{
		document.form1.buttonName.value = "Cos()";
		form1.submit();
	}
	function buttonTan()
	{
		document.form1.buttonName.value = "Tan()";
		form1.submit();
	}
	function buttonPlus()
	{
		document.form1.buttonName.value = "+";
		form1.submit();
	}
	function buttonMinus()
	{
		document.form1.buttonName.value = "-";
		form1.submit();
	}
	function buttonMultiplication()
	{
		document.form1.buttonName.value = "*";
		form1.submit();
	}
	function buttonDivision()
	{
		document.form1.buttonName.value = "/";
		form1.submit();
	}
	function buttonDerivative()
	{
		document.form1.buttonName.value = "Derivative";
		form1.submit();
	}
	function buttonIntegral()
	{
		document.form1.buttonName.value = "Integral";
		form1.submit();
	}
	function buttonSquareRoot()
	{
		document.form1.buttonName.value = "Square Root";
		form1.submit();
	}
	function buttonQuadratic()
	{
		document.form1.buttonName.value = "Quadratic";
		form1.submit();
	}


	
</SCRIPT>

</body>
</html>